package com.lxj;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * TestStream
 */
public class TestStream {

    public static void main(String[] args) {
        try {
            String filepath = "f:/ite/dd.txt";
            File f = new File(filepath);

            // 1.输出流
            // FileInputStream fis = new FileInputStream(f);

            // // 创建字节数组
            // byte[] all = new byte[(int) f.length()];
            // fis.read(all);

            // for (byte b : all) {
            //     System.out.println(b);
            // }

            // 2.输出流
            byte data[] = {108,120,106,88, 89};

            FileOutputStream fos = new FileOutputStream(f);
            fos.write(data);


            // 关闭文件流
            fos.close();
            
        } catch (Exception e) {
            e.printStackTrace();
            //TODO: handle exception
        }
    }
}